import request from "@/utils/request";

//获取区域列表
export function getAreaList(pageIndex,pageSize,name) {
  return request({
    url: `/vm-service/region/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,name
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}

//新建区域
export function addArea(data) {
  return request({
    url: `/vm-service/region`,
    method: 'post',
    data
  })
}

//获取区域详情
export function getAreaDetails(regionId) {
  return request({
    url: `/vm-service/region/${regionId}`,
    method: 'get'
  })
}
//修改区域信息
export function changeAreaDetails(data,regionId) {
  return request({
    url: `/vm-service/region/${regionId}`,
    method: 'put',
    data
  })
}
//获取区域详情//查看详情
export function lookDetails(regionId) {
  return request({
    url: `/vm-service/node/search`,
    method: 'get',
    params: {
      regionId
    },
  })
}

//点位管理页面 列表
export function getNodeList(pageIndex,pageSize,name,regionId) {
  return request({
    url: `/vm-service/node/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,name,regionId
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}

//获取区域详情//查看详情
export function lookVmDetails(id) {
  return request({
    url: `/vm-service/node/vmList/${id}`,
    method: 'get',
  })
}
//新建点位
export function addNode(data) {
  return request({
    url: `/vm-service/node`,
    method: 'post',
    data
  })
}
//点位管理页面 区域数组
export function getAreaOption(pageIndex,pageSize) {
  return request({
    url: `/vm-service/region/search`,
    method: 'get',
    params: {
      pageIndex,pageSize
    }
  })
}
//点位管理页面 商圈类型数组
export function businessTypeOption() {
  return request({
    url: `/vm-service/businessType`,
    method: 'get',
  })
}
//点位管理页面 合作商数组
export function partnerOption(pageIndex,pageSize) {
  return request({
    url: `/user-service/partner/search`,
    method: 'get',
    params: {
      pageIndex,pageSize
    }
  })
}
//修改点位信息
export function changeNodeDetails(data,id) {
  return request({
    url: `/vm-service/node/${id}`,
    method: 'put',
    data
  })
}

//合作商页面 getpartnerlist
export function getPartnerList(pageIndex,pageSize,name) {
  return request({
    url: `/user-service/partner/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,name
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}
//新建合作商
export function addpartner(data) {
  return request({
    url: `/user-service/partner`,
    method: 'post',
    data
  })
}
//修改合作商
export function changePartnerDetails(data,id) {
  return request({
    url: `/user-service/partner/${id}`,
    method: 'put',
    data
  })
}
//修改合作商密码
export function changePartnerPwd(id) {
  return request({
    url: `/user-service/partner/resetPwd/${id}`,
    method: 'PUT',
  })
}
//删除合作商
export function delPartner(id) {
  return request({
    url: `/user-service/partner/${id}`,
    method: 'delete',
  })
}
